#!user/bin/env python3
# -- coding: utf-8 --
# @Createtime：2023/9/11 10:09
# @Updatetime：10:09
# @Author：Test008
# @File：14-Union类型注解3
# @Description：
""""
Union类型注解主要是为了解决注解中包含多种类型方式的问题
Union[str, int]表示里面可以传字符串也可以传数字
"""
# from typing import Union
#
# my_list: list[Union[str, int]] = [1, 2, "张三", "bobby"]
# my_dict: dict[str, Union[str, int]] = {"name": "漳卅", "age": 11}


# def func(data: Union[str, int]) -> Union[str, int]:
#     return data

# print(func("张三"))
# print(func(8))

from typing import Union

my_list: list[Union[str, int]] = [1, 2, "abby", "dily"]

my_dict: dict[str, Union[str, int], tuple] = {"运动": "打篮球", "age": 10, "hooby": ("看书", "跑步")}
print(my_dict)


def func(data: Union[str, int]) -> Union[str, int]:
    pass


print(func("age"))
